<template>
  <el-card shadow="hover" class="scene-last-group">
    <!-- <el-scrollbar class="group-scroll p-2" v-if="type == 4">
      <div class="flex justify-between mb-1">
        <span>贴文</span><span class="text-tips-color font-sm">2019-09-08</span>
      </div>
      <el-text line-clamp="5">
        The -webkit-line-clamp CSS property allows limiting of the contents of a
        block to the specified number of lines.
      </el-text>
      <el-link type="primary" target="_blank"
        ><span class="font-sm">查看原文</span></el-link
      >
    </el-scrollbar> -->
    <el-table
      v-if="live_type != 4"
      :data="groupData"
      style="width: 100%"
      class="tab-scroll"
      :header-cell-style="{
        paddingTop: '12px',
        paddingBottom: '10px',
      }"
      :cell-style="{
        fontSize: '13px',
      }"
    >
      <template #empty>暂无直播标组</template>
      <el-table-column label="标组ID" prop="group_id" />
      <el-table-column label="标组名称" prop="group_name" />
      <el-table-column label="关键字" prop="group_key" />
      <el-table-column label="标组金额" prop="group_price" />
      <el-table-column label="标组内容" prop="group_content" />
      <el-table-column label="标组模式" prop="group_type_name" />
    </el-table>

    <template #header>
      <div class="flex flex-wrap" :class="{ 'justify-end': live_type != 4 }">
        <!-- <el-link
          class="mb-1"
          href="https://element-plus.org"
          target="_blank"
          type="primary"
          >标组管理</el-link
        > -->
        <el-button class="mb" type="primary" plain @click="openGroup"
          >标组管理</el-button
        >
        <el-popover
          placement="top-start"
          :width="100"
          trigger="hover"
          content="点击『修改标组』，可以修改尚未开始竞标的标组内容，也可以新增标组"
        >
          <template #reference>
            <el-button class="mb" type="danger" plain @click="openCreateGroup">新增标组</el-button>
            <!-- <el-link class="mb-1" type="danger">新增标组</el-link> -->
          </template>
        </el-popover>
        <el-popover
          placement="top-start"
          title="Title"
          :width="100"
          trigger="hover"
          content="显示本次直播的所有得标者的名单，显示到当前标组"
        >
          <template #reference>
            <el-button class="mb" type="info" plain>得标结果</el-button>
            <!-- <el-link class="mb-1" type="info">得标结果</el-link> -->
          </template>
        </el-popover>
        <el-popover
          placement="top-start"
          :width="100"
          trigger="hover"
          content="对本次直播进行抽奖操作"
        >
          <template #reference>
            <el-button class="mb" type="warning" plain>抽奖</el-button>
            <!-- <el-link class="mb-1" type="warning">抽奖</el-link> -->
          </template>
        </el-popover>
      </div>
    </template>
  </el-card>
  <el-drawer
    direction="ltr"
    size="100%"
    v-model="drawer"
    class="last-group-draw"
    :show-close="true"
    :destroy-on-close="true"
    :before-close="drawClose"
  >
    <template #header>
      <h4>标组管理</h4>
      <el-space :size="10" style="margin-right: 43%">
        <el-button type="primary">商城上架</el-button>
        <el-dropdown>
          <el-button type="info">
            导入标组<el-icon class="el-icon--right"><arrow-down /></el-icon>
          </el-button>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item>导入标组</el-dropdown-item>
              <el-dropdown-item>导入标组模版</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </el-space>
    </template>
    <div class="flex last-group">
      <div class="manage">
        <group-manage></group-manage>
      </div>
      <div class="create">
        <create-group></create-group>
      </div>
    </div>
  </el-drawer>
  <el-drawer
    direction="ltr"
    size="50%"
    v-model="createDrawer"
    class="last-group-draw"
    :show-close="true"
    :destroy-on-close="true"
  >
    <template #header>
      <h4>新增标组</h4>
      <el-space :size="10">
        <el-button type="primary">商城上架</el-button>
        <el-button type="primary">商城上架</el-button>
      </el-space>
    </template>

     
    
        <create-group></create-group>
  
    
  </el-drawer>
</template>
<script lang="ts" setup>
import CreateGroup from "./CreateGroup.vue";
import GroupManage from "./GroupManage.vue";
import { reactive, ref, onMounted, nextTick, inject } from "vue";
import {
  InfoFilled,
  Edit,
  Search,
  Download,
  Refresh,
  ChatDotRound,
  ArrowDown,
  Close,
} from "@element-plus/icons-vue";
import { useCommonStore } from "@/store/common";
const useCommon = useCommonStore();
const live_id = inject("liveId");
const live_type = inject("liveType");
const drawer = ref(false);
const createDrawer = ref(false);
const props = defineProps({
  data: {
    type: Object,
    default: {},
  },
  groupData: {
    type: Object,
    default: {},
  },
});
const openGroup = () => {
  drawer.value = true;
  useCommon.setShowIframe(false);
};
const openCreateGroup = () => {
  createDrawer.value = true;
};
const drawClose = (done: () => void) => {
  useCommon.setShowIframe(true);
  done();
};
console.log(props.groupData);
</script>
<style>
.last-group-draw {
  .el-drawer__header {
    padding: 0 20px;
    height: 60px;
    border-bottom: 1px solid var(--el-border-color);
  }
  .el-drawer__body {
    padding: 0;
  }
}
.ec2-btncon {
  .el-button {
    margin-bottom: 2px;
    justify-content: flex-start;
  }
  .el-button + .el-button {
    margin-left: 0;
  }
}
</style>
<style scoped lang="scss">
.tab-scroll {
  height: 250px;
}
.manage {
  width: 55%;
}
.create {
  width: 45%;
  height: calc(100vh - 61px);
  border-left: 1px solid var(--el-border-color);
}

.scroll {
  height: calc(100vh - 350px);
}

.primaryColor {
  color: var(--el-color-primary);
}
</style>
